﻿//生成海报图
layui.use(['jquery', 'ajaxUtil', 'layedit', 'dialog', 'permissionUtil'], function () {
    var $ = layui.jquery
        , ajaxutil = layui.ajaxUtil
        , layedit = layui.layedit
        , dialog = layui.dialog
        , permissionUtil = layui.permissionUtil;
    //permissionUtil.setting(150020);

    var init = function () {
        initBtnEvent();
    }

    var initBtnEvent = function () {
        $("#btn_File_CreatePosterImg").unbind("click");
        $("#btn_File_CreatePosterImg").bind("click", function () {
            createPosterImg();
        });

        createPosterImg();
    }

    var createPosterImg = function () {
        ajaxutil.request({
            url: '/file/postercompound/createposterimg'
            , data: {
                PosterCoverUrl: $("#txt_FilePosterCoverUrl").val(),
                Title: $("#txt_FileTitle").val(),
                OriginPrice: $("#txt_FileOriginPrice").val(),
                FinalPrice: $("#txt_FileFinalPrice").val()
            }
            , success: function (res) {
                if (res.code == 200) {
                    $("#imgPosterCover").attr("src", res.data.posterImgUrl)
                }
                else {
                    dialog.alert.fail(res.msg);
                }
            }
        });
    }

    init();
});